import { post, ajax } from '@/utils/ajax';

// 查询部署管理列表
export function search(query) {
    return post('/wf/manager/deployment/search', query);
}
//配置按钮
export function getConfigButtons(deploymentId) {
    return post('/wf/manager/deployment/getConfigButtons', { deploymentId });
}
export function saveConfigButtons(deploymentId, buttons) {
    return post('/wf/manager/deployment/saveConfigButtons', {
        deploymentId,
        buttons
    });
}

//配置审批页面
export function getConfigUrls(deploymentId) {
    return post('/wf/manager/deployment/getConfigUrls?deploymentId=' + deploymentId + '&r=' + new Date().getTime());
}
export function saveConfigUrls(data) {
    return post('/wf/manager/deployment/saveConfigUrls', data, { objectAsMap: true });
}

// 获取流程图
export function showFlowRunImgByDeployment(processInstanceId) {
    return ajax({
        url: '/wf/manager/deployment/showFlowRunImgByInstantId',
        method: 'post',
        data: { processInstanceId },
        responseType: 'arraybuffer'
    });
}

//撤销发布
export function delDeployment(modelId) {
    return post('/wf/manager/deployment/revokePublishByModelId', { 'modelId': modelId });
}

//审批配置
export function getConfigApprove(deploymentId) {
    return post('/wf/manager/deployment/getConfigApprove', { deploymentId });
}
//保存配置
export function saveConfigApprove(data) {
    return post('/wf/manager/deployment/saveConfigApprove', data, { objectAsMap: true });
}

// 插入流程授权配置信息
export function insertAuthInfo(query) {
    return post('/wf/manager/deployment/insertAuthInfo', query);
}

// 根据流程编码获取是否开启授权信息
export function getEnableAuthByWfCode(wfCode) {
    return post('/wf/manager/deployment/getEnableAuthByWfCode', { wfCode });
}

// 开启/关闭授权信息
export function saveEnableAuth(query) {
    return post('/wf/manager/deployment/saveEnableAuth', query);
}

// 获取人员授权信息id列表
export function searchAuthUser(query) {
    return post('/wf/manager/deployment/searchAuthUser', query);
}

// 获取部门授权信息id列表
export function searchAuthDept(query) {
    return post('/wf/manager/deployment/searchAuthDept', query);
}

// 获取公司授权信息id列表
export function searchAuthCompany(query) {
    return post('/wf/manager/deployment/searchAuthCompany', query);
}

// 获取角色授权信息id列表
export function searchAuthRole(query) {
    return post('/wf/manager/deployment/searchAuthRole', query);
}

// 获取岗位授权信息id列表
export function searchAuthPost(query) {
    return post('/wf/manager/deployment/searchAuthPost', query);
}

// 删除授权信息
export function deleteAuthInfo(query) {
    return post('/wf/manager/deployment/deleteAuthInfo', query);
}

// 获取事件配置信息
export function getEventConfigByWfCode(wfCode){
    return post('/wf/manager/deployment/getEventConfigByWfCode', {wfCode});
}

// 保存事件配置信息
export function saveConfigEvent(params){
    return post('/wf/manager/deployment/saveConfigEvent', params)
}
